home *** CD-ROM | disk | FTP | other *** search
- <refentry id="libgimp-gimpsignal" revision="19 Jan 2001">
- <refmeta>
- <refentrytitle>gimpsignal</refentrytitle>
- <manvolnum>3</manvolnum>
- <refmiscinfo>LIBGIMP Library</refmiscinfo>
- </refmeta>
-
- <refnamediv>
- <refname>gimpsignal</refname><refpurpose>Portable signal handling.</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv><title>Synopsis</title>
- <synopsis>
-
-
-
- #define <link linkend="SA-RESTART-CAPS">SA_RESTART</link>
- void (<link linkend="GimpSignalHandlerFunc">*GimpSignalHandlerFunc</link>) (<link linkend="gint">gint</link> signum);
- <link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> <link linkend="gimp-signal-private">gimp_signal_private</link> (<link linkend="gint">gint</link> signum,
- <link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> handler,
- <link linkend="gint">gint</link> flags);
- #define <link linkend="gimp-signal-syscallrestart">gimp_signal_syscallrestart</link> (signum,handler)
- </synopsis>
- </refsynopsisdiv>
-
-
-
-
-
- <refsect1>
- <title>Description</title>
- <para>
- Portable signal handling.
-
- </para>
- </refsect1>
-
- <refsect1>
- <title>Details</title>
- <refsect2>
- <title><anchor id="SA-RESTART-CAPS">SA_RESTART</title>
- <programlisting>#define SA_RESTART SA_SYSV
- </programlisting>
- <para>
- This is just an alias for systems which do not define SA_RESTART.
- </para></refsect2>
- <refsect2>
- <title><anchor id="GimpSignalHandlerFunc">GimpSignalHandlerFunc ()</title>
- <programlisting>void (*GimpSignalHandlerFunc) (<link linkend="gint">gint</link> signum);</programlisting>
- <para>
- A prototype for signal handler functions. Note that each function which
- takes or returns a variable of this type also accepts or may return
- special values defined by your system's signal.h header file (like
- <parameter>SIG_DFL</parameter> or <parameter>SIG_IGN</parameter>).
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>signum</parameter> :</entry>
- <entry>The number of the signal. Useful if different signals are handled
- by a single handler.
-
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-signal-private">gimp_signal_private ()</title>
- <programlisting><link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> gimp_signal_private (<link linkend="gint">gint</link> signum,
- <link linkend="GimpSignalHandlerFunc">GimpSignalHandlerFunc</link> handler,
- <link linkend="gint">gint</link> flags);</programlisting>
- <para>
- This function furnishes a workalike for signal(2) but
- which internally invokes sigaction(2) after certain
- sa_flags are set; these primarily to ensure restarting
- of interrupted system calls. See sigaction(2) It is a
- aid to transition and not new development: that effort
- should employ sigaction directly. [gosgood 18.04.2000]
- </para>
- <para>
- Cause <parameter>handler</parameter> to be run when <parameter>signum</parameter> is delivered. We
- use sigaction(2) rather than signal(2) so that we can control the
- signal handler's environment completely via <parameter>flags</parameter>: some signal(2)
- implementations differ in their sematics, so we need to nail down
- exactly what we want. [austin 06.04.2000]</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>signum</parameter> :</entry>
- <entry> Selects signal to be handled see man 5 signal (or man 7 signal)
- </entry></row>
- <row><entry align="right"><parameter>handler</parameter> :</entry>
- <entry> Handler that maps to signum. Invoked by O/S.
- Handler gets signal that caused invocation. Corresponds
- to the <parameter>sa_handler</parameter> field of the <parameter>sigaction</parameter> struct.
- </entry></row>
- <row><entry align="right"><parameter>flags</parameter> :</entry>
- <entry> Preferences. OR'ed SA_<xxx>. See man sigaction. Corresponds
- to the <parameter>sa_flags</parameter> field of the <parameter>sigaction</parameter> struct.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A reference to the signal handling function which was
- active before the call to <link linkend="gimp-signal-private">gimp_signal_private</link>().
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-signal-syscallrestart">gimp_signal_syscallrestart()</title>
- <programlisting>#define gimp_signal_syscallrestart(signum,handler) gimp_signal_private ((signum), (handler), SA_RESTART)
- </programlisting>
- <para>
- Installs a signal handler in a way that system calls which were not finished
- at the time of signal handler invocation will be silently restarted
- by the system (without failing with an error of EINTR).
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>signum</parameter> :</entry>
- <entry>The number of the signal.
- </entry></row>
- <row><entry align="right"><parameter>handler</parameter> :</entry>
- <entry>The signal handler.
-
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
-
- </refsect1>
-
-
-
- <refsect1>
- <title>See Also</title>
- <para>
- signal(2), signal(5 or 7), sigaction(2).
- </para>
- </refsect1>
-
- </refentry>
-